package cn.lijida.weiwei.favor.modules.relation.service.impl;

import java.util.Date;

import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import cn.lijida.weiwei.favor.modules.relation.entity.FavorRelation;
import cn.lijida.weiwei.favor.modules.relation.mapper.FavorRelationMapper;
import cn.lijida.weiwei.favor.modules.relation.service.IFavorRelationService;

/**
 * <p>
 * 关系 服务实现类
 * </p>
 *
 * @author jobob
 * @since 2019-12-28
 */
@Service
public class FavorRelationServiceImpl extends ServiceImpl<FavorRelationMapper, FavorRelation> implements IFavorRelationService {

	@Override
	public void create(FavorRelation relation, Long loginId) throws Exception {
		
		relation.setCreateTime(new Date());
		relation.setMemberId(loginId);
		
		boolean status = this.save(relation);
		if(!status){
			throw new Exception("添加送礼记录失败");
		}
	}

}
